package org.testmyapp.entities;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;

import org.testmyapp.persistence.BusinessObjectMarker;

@Entity
public class Person extends AbsProcessRelatedObject implements BusinessObjectMarker {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8787020233873612902L;

	public static String tableName = "Person";
	
	@Id
	private Integer personId;
	private String firstName;
	private String lastName;
	private String Adresse;
	
	public Integer getPersonId() {
		return personId;
	}
	public void setPersonId(Integer personId) {
		this.personId = personId;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public String getAdresse() {
		return Adresse;
	}
	public void setAdresse(String adresse) {
		Adresse = adresse;
	}
	
	public String toString() {
		return personId + ": " + firstName + " " + lastName;
	}
	
	public boolean equals(Object o) {
		if (o == this)
			return true;
		if (!(o instanceof Person) || o == null)
			return false;
		Person other = (Person) o;
		if ((this.getPersonId() == null && other.getPersonId() != null)
				|| (!this.getPersonId().equals(other.getPersonId()))) {
			return false;
		}
		if ((this.getFirstName() == null && other.getFirstName() != null)
				|| !this.getFirstName().equals(other.getFirstName())) {
			return false;
		}
		if ((this.getLastName() == null && other.getLastName() != null)
				|| !this.getLastName().equals(other.getLastName())) {
			return false;
		}
		if ((this.getAdresse() == null && other.getAdresse() != null)
				|| !this.getAdresse().equals(other.getAdresse())) {
			return false;
		}
		return true;
	}
	
}
